How to Use nullif()

The nullif(value1, value2) function returns null when value1 and value2 are equal. Otherwise it returns value1. This can be used to perform the inverse operation of the coalesce function.

select nullif('hello','bye') from dual; -- Returns 'hello'

select nullif('hello','hello') from dual;  -- Returns NULL

IN THIS PAGE